# $Id: Makefile 56 2013-04-02 10:11:02Z chris.charles.allison@gmail.com $
# compiler settings for all makefiles

CC = gcc
CFLAGS = -ggdb -W -Wall
LD = $(CC)
LDFLAGS =`mysql_config --libs`
LIBS = `mysql_config --libs`

SRC := $(wildcard *.c)
OBJ := $(SRC:.c=.o)
DOBJ := $(SRC:.c=.d)

BINNAME = qillsd

$(BINNAME): $(OBJ)
	$(CC) -o $@ $(OBJ) `mysql_config --libs`

include $(OBJ:.o=.d)

%.d: %.c
	./depend.sh $(CFLAGS) $*.c > $@

client.d: client.c
	./depend.sh `mysql_config --cflags` $(CFLAGS) client.c >client.d

client.o: client.c defs.h macros.h
	$(CC) `mysql_config --cflags` -o client.o -c client.c

clean:
	-rm -f $(DOBJ) $(OBJ) $(BINNAME)
